//
//  THInviteUserViewController.m
//  TreeHole
//
//  Created by apple on 2020/9/1.
//  Copyright © 2020 stoneobs. All rights reserved.
//

#import "THInviteUserViewController.h"

@interface THInviteUserViewController ()

@end

@implementation THInviteUserViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"分享";
    [self stoneobs_ui_configSubView];
    [self stoneobs_fun_st_setRightItemWithTitle:@"分享" titleColor:STONEOBS_UI_FIRST_TEXT_COLOR];
    // Do any additional setup after loading the view.
}
#pragma mark --configSubView
- (void)stoneobs_ui_configSubView{
    UIView * header = [[UIView alloc] initWithFrame:STONEOBS_UI_UISCREEN_FRAME];
    THUserModel * user = STTools_UserManger.defult.stoneobs_fun_get_loginedUser;
    
    UIView * white_view = [[UIView alloc] initWithFrame:CGRectMake(35, 45, UISCREEN_WIDTH - 70, 400)];
    white_view.backgroundColor = UIColor.whiteColor;
    white_view.layer.cornerRadius = 10;
    white_view.clipsToBounds = YES;
    [header addSubview:white_view];
    
    
    STButton * stoneobs_ui_button = [[STButton alloc] initWithFrame:CGRectMake(23, 20, 42, 42)
                                                              title:@""
                                                         titleColor:nil
                                                          titleFont:0
                                                       cornerRadius:0
                                                    backgroundColor:nil
                                                    backgroundImage:nil
                                                              image:nil];
    [white_view addSubview:stoneobs_ui_button];
    [stoneobs_ui_button sd_setImageWithURL:user.header_img.mj_url forState:UIControlStateNormal];
    
    
    STLabel * stoneobs_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(stoneobs_ui_button.right+10, stoneobs_ui_button.top, 200, 20)
                                                            text:user.name
                                                       textColor:STONEOBS_UI_FIRST_TEXT_COLOR
                                                            font:15
                                                     isSizetoFit:NO
                                                   textAlignment:NSTextAlignmentLeft];
    [white_view addSubview:stoneobs_ui_label];
    
    STButton * stoneobs_ui_gender_button = [[STButton alloc] initWithFrame:CGRectMake(stoneobs_ui_label.left, 20, 42, 42)
                                                              title:@""
                                                         titleColor:nil
                                                          titleFont:0
                                                       cornerRadius:0
                                                    backgroundColor:nil
                                                    backgroundImage:nil
                                                              image:ST_IMAGE_NAMED(@"")];
    [white_view addSubview:stoneobs_ui_gender_button];
    stoneobs_ui_gender_button.bottom = stoneobs_ui_button.bottom;
    
    [stoneobs_ui_gender_button setImage:ST_IMAGE_NAMED(@"") forState:UIControlStateSelected];
    
    
    
    STLabel * stoneobs_ui_code_label = [[STLabel alloc] initWithFrame:CGRectMake(0, stoneobs_ui_button.bottom + 30, white_view.width, 20)
                                                                 text:[NSString stringWithFormat:@"邀请码:%@",user.uuid]
                                                       textColor:STONEOBS_UI_FIRST_TEXT_COLOR
                                                            font:15
                                                     isSizetoFit:NO
                                                   textAlignment:NSTextAlignmentCenter];
    [white_view addSubview:stoneobs_ui_code_label];
    stoneobs_ui_code_label.font = [UIFont fontWithName:STONEOBS_UI_FONT_CU_NAME size:17];
    
    
    
    UIImageView * stoneobs_ui_imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, stoneobs_ui_code_label.bottom + 20, 176, 176)];
    [stoneobs_ui_imageView sd_setImageWithURL:user.QrCode.mj_url];
    stoneobs_ui_imageView.centerX = white_view.width / 2;
    [white_view addSubview:stoneobs_ui_imageView];
    
    
    STLabel * stoneobs_ui_s_label = [[STLabel alloc] initWithFrame:CGRectMake(0, stoneobs_ui_imageView.bottom + 20, white_view.width, 20)
                                                                 text:@"扫描二维码，注册成为牛视界用户"
                                                       textColor:STONEOBS_UI_THIRD_TEXT_COLOR
                                                            font:13
                                                     isSizetoFit:NO
                                                   textAlignment:NSTextAlignmentCenter];
    [white_view addSubview:stoneobs_ui_s_label];
    
    white_view.height = stoneobs_ui_s_label.bottom + 20;
    header.height = white_view.bottom + 20;
    self.tableView.tableHeaderView = header;
    
}
- (void)stoneobs_fun_st_rightBarAction:(id)sender{
    [TMUtils goto_share_witdh_url:@""];
}
@end
